package cn.woochen.mvvmframe.activity

import android.content.Context
import android.content.Intent
import android.view.View
import cn.woochen.comlib.util.OnSingleClickListener
import cn.woochen.comlib.util.ext.setOnSingleClickListener
import cn.woochen.mvvmframe.R
import cn.woochen.mvvmframe.config.BaseActivity
import cn.woochen.mvvmframe.databinding.ActivityNotificationBinding
import cn.woochen.mvvmframe.helper.NotificationHelper
import cn.woochen.mvvmframe.viewmodels.EmptyViewModel

/**
 *类描述：通知消息
 *@author woochen
 *@time 2021/9/8 17:18
 */
class NotificationActivity : BaseActivity<ActivityNotificationBinding, EmptyViewModel>(),
    OnSingleClickListener {

    override fun setContentView(): Int = R.layout.activity_notification

    override fun initData() {
        initWidgets()
    }

    private val mChannelId = "conversation"

    private fun initWidgets() {
        NotificationHelper.createNotificationChannel(mContext,mChannelId,"渠道名称","渠道描述")
    }

    override fun initListener() {
        mBinding.btnSend.setOnSingleClickListener(this)
    }

    companion object{
        fun start(context: Context){
            val intent = Intent(context,NotificationActivity::class.java)
            context.startActivity(intent)
        }
    }

    override fun onSingleClick(v: View?) {
        when (v) {
            mBinding.btnSend -> {//发送通知
                NotificationHelper.sendNotify(mContext,mChannelId,1,R.mipmap.ic_launcher,"通知标题","通知副标题",TestActivity::class.java)
            }
            else -> {
            }
        }
    }
}